home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
pvquan16.zip
/
PVQUAN.DOC
< prev
next >
Wrap
Text File
|
1992-12-01
|
20KB
|
476 lines
PVQUANT Version 1.60
Colour Quantisation Utilities
for the
Persistence of Vision Raytracer
Written and Distributed by:
Frank van der Hulst, 101 Epuni St, Lower Hutt, New Zealand
Electronic mail to:
UseNet: f_vander@comp.vuw.ac.nz,
frank@cit.ac.nz,
frank@whare.cavebbs.welly.gen.nz
FidoNet: frank vanderhulst at GenBoard (Node 3:771/160)
01 December 1992
───────────────────────────────────────────────────────────────────────────
These programs are freely distributable. The authors retain the copyright
to the program but authorizes free distribution by BBS'es, networks,
magnetic media, etc. The distributor may charge no more than five dollars
($5) U.S. for this software.
The images and data files generated by these programs are the property of
the user of the software and may be used for any purpose without
restriction.
The authors make no guarantees or warranties with these programs and claim
no responsibility for any damage or loss of time caused by this program.
Bug reports may be sent to the authors but the authors are under no
obligation to provide bug fixes, features, or any support for this software.
The following conditions are placed on the use of this program:
1) That it should not be used as part of any commercial package without the
explicit written consent of the author.
2) If you make any changes to the source code, please let me know. That's
the way this program was built!
3) This text file must accompany the program.
This manual is divided into the following sections:
1) Archive Description
2) Getting Started
3) Command Line Parameters
4) Output File Format
5) Source Code Information
6) Displaying the Images
7) Animation
8) Porting to Different Platforms
2) Background
1) Archive Description
~~~~~~~~~~~~~~~~~~~~~~
This archive contains C source code for a set of programs to convert image
files produced by DKB-Trace or Persistence of Vision raytracer into a format
suitable for display on a VGA screen, or to GIF format. It includes
programs to generate a single stereoscopic 3D image from two views of a
scene, as well as programs to produce animation from multiple ray-traced
images.
The programs (or large parts of them) were written by several different
people. All of the programs are in the public domain to some extent, with
some restrictions put on them by their respective authors. I have collected
these from various places, ported them to Turbo-C, GNU C, or IBM C Set/2 if
necessary, and formatted them in a way that I like. The copyright for each
program still belongs to its author -- my copyright claim extends only to
the collection of programs (like the editor of a journal, for example).
QUANT (HECKBERT & OCTREE): Colour quantisation program which post-processes
raw or Targa image files produced by the Persistence of Vision Ray Tracer
(PoVRay). Two versions can be compiled: one uses Heckbert's
median-splitting algorithm, whereas the other uses Octree quantisation.
DISPLAY: Displays either 320x400 or 320x200 images, either 2D, or stereo
3D. 3D images require Sega 3D-glasses to be connected to the serial port
for viewing.
ANIMDAT: Reads an animation source file (*.VAR), and uses it to generate
data files for the PoV ray tracer.
ANIMGIF: Produces a .GIF file containing a series of images to be displayed
by ANIM.
ANIMFLI: Produces a .FLI file containing a series of images to be displayed
by a .FLI player (e.g. Autodesk's AAPLAY).
2) Getting Started
~~~~~~~~~~~~~~~~~~
Before quantising an image, you must create one! Use either DKB-TRACE or
PoVRAY to produce output in the "Targa" format.
I use the following command line:
POVRAY -ipacman.dat -opacman.tga -w320 -h400 -v +ft +p +x -a
See the raytracer documentation on what all the above mean. Most important
is the "+ft" option which tells the raytracer to produce "Targa" files. The
quantiser can also read "raw" format files (use the "+fr" switch). If you
use this (there's no real reason why you should) and run POVRAY on a PC,
you'll probably need to rename the files produced. By default it gives
extensions of .R8, .G8, and .B8, whereas QUANT needs extensions of .RED,
.GRN, and .BLU.
Now try running the OCTREE quantiser program:
OCTREE pacman
3) Command Line Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~
QUANT is a program to convert image files produced by DKB-Trace or
Persistence of Vision raytracer into a format suitable for display on a VGA
screen.
To do this, it must select 256 colours from a palette of 256K colours to
best represent the colours in the image file which are selected from a
palette of 16 million. In other words, it must "quantise" the colours in
the image file (which are selected from a palette of 16 million) into a set
of 256 colours selected from a palette of 256K colours.
QUANT is a colour quantisation program which post-processes raw or
Targa image files produced by the Persistence of Vision Ray Tracer (PoV
Ray). Two versions can be compiled: one uses Heckbert's median-splitting
algorithm, whereas the other uses Octree quantisation. The Heckbert version
takes much longer to run, especially on a 286. On the other hand, it
produces much better results. The Octree version is faster, but not as
good.
As an additional feature, the program allows the user to generate a single
palette from several image files, thus making it possible to produce a
stereoscopic 3D image from two views of a scene, or animation.
Command line format:
HECKBERT [-C=colours][-W=width][-H=height][-D=display][-T=type]
[-O=outputbits][-S=speed][-N=numfiles] file_name
or
OCTREE [-C=colours][-W=width][-H=height][-D=display][-T=type]
[-O=outputbits][-N=numfiles] file_name
If no parameters are given, a usage message is shown.
Default value
outputbits = bits per colour being output [6]
intype = 0 or 1 to select input format [0]
0 selects raw files (.RED, .GRN,.BLU)
1 selects Targa (.TGA)
type = 0, 1 or 2 to select output format [1]
0 selects 4-planar output for 320x400 or 320x200 images
1 selects linear output
2 selects GIF output.
display = 1 to display while outputting [1]
Only available on the PC.
colours = number of separate colours to produce [256]
width = number of pixels wide the image is [320]
height = number of pixels high the image is [200]
speed = 1 or 0 for fast or slow quantisation [0]
Heckbert speed switch. If zero, the program does another pass
through the data, to find the optimal palette selection. This
pass is much slower than the earlier passes, and produces
slightly better results.
numfiles = number of files to convert [1]
If numfiles = 1, QUANT calculates a palette for that file and
writes it to disk with a .2D extension.
If numfiles = 2, QUANT calculates one combined palette from both
images, then writes this palette, as well as the data from
both files to an output file with a .3D extension.
If numfiles > 2, QUANT assumes this is an animation sequence,
and generates one palette for all the files, then writes the
output in the form of several 2D-format files (one for each
input file), all with the same palette. The files are named
FILE_0.0, FILE_0.1, FILE_0.2, ...
file_name the base part of the filename(s) of files to be converted -- a
numeric part and an extension are added automatically. The
nu